import {BasicColumn} from '@/components/Table';
import {FormSchema} from '@/components/Table';
import { rules} from '@/utils/helper/validator';
import { render } from '@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '产品',
    align:"center",
    dataIndex: 'productNo',
     customRender:(data) =>{
       return data.record.productNo+"("+data.record.productNo_dictText+")"
     },
   },
   {
    title: '仓储要求',
    align:"center",
    dataIndex: 'ask'
   },
   {
    title: '温度',
    align:"center",
    dataIndex: 'temperature'
   },
   {
    title: '湿度',
    align:"center",
    dataIndex: 'humidity'
   },
   {
    title: '仓储日期',
    align:"center",
    dataIndex: 'storageTime'
   },
   {
    title: '是否上链',
    align:"center",
    dataIndex: 'location',
    customRender:(data) =>{
      return data.record.cngData ? '已上链' : '未上链'
    },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '产品',
    field: 'productNo',
    component: 'JSearchSelect',
    componentProps: {
      dict: 't_product,name,no',
    }
  }
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '产品',
    field: 'productNo',
    component: 'JSearchSelect',
    componentProps: {
      dict: 't_product,name,no',
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请选择产品!'},
      ];
    },
  },
  {
    label: '仓储要求',
    field: 'ask',
    component: 'InputTextArea',
  },
  {
    label: '温度',
    field: 'temperature',
    component: 'Input',
  },
  {
    label: '湿度',
    field: 'humidity',
    component: 'Input',
  },
  {
    label: '仓储日期',
    field: 'storageTime',
    component: 'DatePicker',
    componentProps: {
       showTime: false,
       valueFormat: 'YYYY-MM-DD'
     },
  },
  {
    label: '文件',
    field: 'fileInfo',
    component: 'JUpload',
    componentProps: {
      bizPath:null,
      fileMax: 5,
      multiple:true
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
